import request from '@/utils/request';

/**
 * 创建支付宝支付订单
 * @param {string} orderId - 订单ID
 * @returns {Promise} 返回支付表单HTML
 */
export const createAlipayOrder = (orderId) => {
  return request({
    url: `/product/payment/alipay/create?orderId=${orderId}`,
    method: 'post',
    responseType: 'text', // 因为返回的是HTML表单
    timeout: 120000 // 支付宝接口单独设置2分钟超时
  });
};

/**
 * 查询支付状态
 * @param {string} orderId - 订单ID
 * @returns {Promise}
 */
export const queryPaymentStatus = (orderId) => {
  return request({
    url: `/product/payment/status/${orderId}`,
    method: 'get'
  });
};